package com.franklin.java.api.find;

import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * @author Franklin
 * @since 2021/9/7 15:54
 */
public class MyFindManager {

    protected Project myProject;
    protected MyFindUsagesManager myFindUsagesManager;

    public MyFindManager(Project project) {
        this.myProject = project;
        this.myFindUsagesManager = new MyFindUsagesManager(project);
    }

    public static MyFindManager getInstance(Project project){
        return project.getService(MyFindManager.class);
    }

    public boolean canFindUsages(@NotNull PsiElement psiElement){
        return myFindUsagesManager.canFindUsages(psiElement);
    }

    public List<PsiElement> findUsages(@NotNull PsiElement element) {
        return findUsages(element, false);
    }

    public List<PsiElement> findUsages(@NotNull PsiElement element, boolean showDialog) {
        return myFindUsagesManager.findUsages(element, null, null, showDialog, null);
    }
}
